package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojos.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class HelloListener {

    @KafkaListener(topics = "tcast-topic")
    public void onMessage(String message){
        System.out.println("消费到了消息："+message);
    }

    @KafkaListener(topics = "tcast-topic2")
    public void onMessage2(String message){
        User user = JSON.parseObject(message, User.class);
        System.out.println(user);
    }
}
